package com.abl.common.controller.app;

import com.abl.core.domain.db.MtRoom;
import com.abl.core.domain.db.MtRoomUserAuth;
import com.abl.core.domain.mt.MtLiveRoomVo;
import com.abl.core.domain.project.SRS;
import com.abl.core.service.mt.MtLiveRoomService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 移动端会议相关接口
 */
@RestController
@RequestMapping("/common/app/live")
public class MtLiveRoomC {

    @Resource
    private MtLiveRoomService mtLiveRoomService;

    //当前房间信息
    @PostMapping("/roomInfo")
    public SRS<MtLiveRoomVo> roomInfo( String mtId) {
        MtLiveRoomVo mtLiveRoomVo = mtLiveRoomService.roomInfo(mtId);
        return SRS.bySuccess(mtLiveRoomVo);
    }

    //申请连麦
    @PostMapping("/applyTop")
    public SRS<Boolean> applyTop(String mtId) {
        boolean b = mtLiveRoomService.applyTop(mtId);
        return SRS.bySuccess(b);
    }

    //同意连麦
    @PostMapping("/agreeTop")
    public SRS<Boolean> agreeTop(String userId, String mtId) {
        boolean b = mtLiveRoomService.agreeTop(userId, mtId);
        return SRS.bySuccess(b);
    }

    //拒绝连麦
    @PostMapping("/refuseTop")
    public SRS<Boolean> refuseTop(String userId, String mtId) {
        boolean b = mtLiveRoomService.refuseTop(userId, mtId);
        return SRS.bySuccess(b);
    }

    //强制下麦
    @PostMapping("/outTop")
    public SRS<Boolean> outTop(String userId, String mtId) {
        boolean b = mtLiveRoomService.outTop(userId, mtId);
        return SRS.bySuccess(b);
    }

    //连麦列表
    @PostMapping("/topList")
    public SRS<MtRoomUserAuth> topList(String mtId) {
        List<MtRoomUserAuth> mtRoomUserAuths = mtLiveRoomService.topList(mtId);
        return SRS.bySuccess(mtRoomUserAuths);
    }

    //我的信息
    @PostMapping("/myInfo")
    public SRS<MtRoomUserAuth> myInfo(String mtId) {
        MtRoomUserAuth mtRoomUserAuth = mtLiveRoomService.myInfo(mtId);
        return SRS.bySuccess(mtRoomUserAuth);
    }

}
